package my.jypark.seminar;

import java.io.DataInputStream;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * User: jypark
 * Date: 13. 10. 29
 * Time: 오후 12:07
 * To change this template use File | Settings | File Templates.
 */
public class AttributeFactory {
    public static Attribute getReader(DataInputStream ins) throws IOException {
        String name = Loader.cmap.get(ins.readShort()).str;

        if (name.equals("Code"))
            return new CodeAttribute(name, ins);

        if (name.equals("LineNumberTable"))
            return new LineNumberTableAttribute(name, ins);

        if (name.equals("LocalVariableTable"))
            return new LocalVariableTableAttribute(name, ins);

        return new Attribute(name, ins);
    }
}
